﻿// HSS.Interlink.UploadFileView.xaml.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.html)
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       UploadFileView.xaml.cs
// Author:     HSS\gbanta
// Created:    07/16/2011
// Modified:   07/22/2011
// ----------------------------------------------------------------------------
namespace HSS.Interlink
{
	#region Using Directives
	using System.Windows.Controls;
	#endregion

	#region UploadFileView
	/// <summary>
	/// UploadFileView displays a file to be uploaded.
	/// </summary>
	public sealed partial class UploadFileView : UserControl
	{
		#region Constructors
		/// <summary>
		/// Constructor
		/// </summary>
		public UploadFileView()
		{
			InitializeComponent();
			this.Loaded += (s, e) =>
				{
					if (null != this.ViewModel)
						this.ViewModel.InitializeView(this);
					else
						this.txtFileName.Text = "Unknown ViewModel!";
				};
			this.Unloaded += (s, e) =>
				{
					if (null != this.ViewModel)
						this.ViewModel.UnintializeView();
					else
						this.txtFileName.Text = "Unknown ViewModel!";
					this.DataContext = null;
				};
		}
		#endregion

		#region Properties
		private UploadFileViewModel ViewModel
		{
			get
			{
				if (this.DataContext != null)
					return ((UploadFileViewModel)this.DataContext);
				else
					return null;
			}
		}
		#endregion
	}
	#endregion
}